package cn.iocoder.yudao.module.biz.dal.mysql.emergencyReservePlan;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.biz.controller.admin.emergencyReservePlan.vo.BizEmergencyReservePlanExportReqVO;
import cn.iocoder.yudao.module.biz.controller.admin.emergencyReservePlan.vo.BizEmergencyReservePlanPageReqVO;
import cn.iocoder.yudao.module.biz.dal.dataobject.emergencyReservePlan.BizEmergencyReservePlanDO;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;
import java.util.Map;

/**
 * 应急预案 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface BizEmergencyReservePlanMapper extends BaseMapperX<BizEmergencyReservePlanDO> {

    default PageResult<BizEmergencyReservePlanDO> selectPage(BizEmergencyReservePlanPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<BizEmergencyReservePlanDO>()
                .likeIfPresent(BizEmergencyReservePlanDO::getName, reqVO.getName())
                .eqIfPresent(BizEmergencyReservePlanDO::getLevel, reqVO.getLevel())
                .eqIfPresent(BizEmergencyReservePlanDO::getType, reqVO.getType())
                .likeIfPresent(BizEmergencyReservePlanDO::getResponsible, reqVO.getResponsible())
//                .eqIfPresent(BizEmergencyReservePlanDO::getRemark, reqVO.getRemark())
                .eqIfPresent(BizEmergencyReservePlanDO::getStartYear, reqVO.getStartYear())
                .eqIfPresent(BizEmergencyReservePlanDO::getEndYear, reqVO.getEndYear())
//                .eqIfPresent(BizEmergencyReservePlanDO::getJanuaryNumberOfDrills, reqVO.getJanuaryNumberOfDrills())
//                .eqIfPresent(BizEmergencyReservePlanDO::getFebruaryNumberOfDrills, reqVO.getFebruaryNumberOfDrills())
//                .eqIfPresent(BizEmergencyReservePlanDO::getMarchNumberOfDrills, reqVO.getMarchNumberOfDrills())
//                .eqIfPresent(BizEmergencyReservePlanDO::getAprilNumberOfDrills, reqVO.getAprilNumberOfDrills())
//                .eqIfPresent(BizEmergencyReservePlanDO::getMayNumberOfDrills, reqVO.getMayNumberOfDrills())
//                .eqIfPresent(BizEmergencyReservePlanDO::getJuneNumberOfDrills, reqVO.getJuneNumberOfDrills())
//                .eqIfPresent(BizEmergencyReservePlanDO::getJulyNumberOfDrills, reqVO.getJulyNumberOfDrills())
//                .eqIfPresent(BizEmergencyReservePlanDO::getAugustNumberOfDrills, reqVO.getAugustNumberOfDrills())
//                .eqIfPresent(BizEmergencyReservePlanDO::getSeptemberNumberOfDrills, reqVO.getSeptemberNumberOfDrills())
//                .eqIfPresent(BizEmergencyReservePlanDO::getOctoberNumberOfDrills, reqVO.getOctoberNumberOfDrills())
//                .eqIfPresent(BizEmergencyReservePlanDO::getNovemberNumberOfDrills, reqVO.getNovemberNumberOfDrills())
//                .eqIfPresent(BizEmergencyReservePlanDO::getDecemberNumberOfDrills, reqVO.getDecemberNumberOfDrills())
                .eqIfPresent(BizEmergencyReservePlanDO::getStatus, reqVO.getStatus())
                .eqIfPresent(BizEmergencyReservePlanDO::getNumberOfFinish, reqVO.getNumberOfFinish())
//                .eqIfPresent(BizEmergencyReservePlanDO::getAppendix, reqVO.getAppendix())
//                .betweenIfPresent(BizEmergencyReservePlanDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime())
//                .eqIfPresent(BizEmergencyReservePlanDO::getDeptId, reqVO.getDeptId())
                .orderByDesc(BizEmergencyReservePlanDO::getId));
    }

    default List<BizEmergencyReservePlanDO> selectList(BizEmergencyReservePlanExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<BizEmergencyReservePlanDO>()
                .likeIfPresent(BizEmergencyReservePlanDO::getName, reqVO.getName())
                .eqIfPresent(BizEmergencyReservePlanDO::getLevel, reqVO.getLevel())
                .eqIfPresent(BizEmergencyReservePlanDO::getType, reqVO.getType())
                .likeIfPresent(BizEmergencyReservePlanDO::getResponsible, reqVO.getResponsible())
//                .eqIfPresent(BizEmergencyReservePlanDO::getRemark, reqVO.getRemark())
                .eqIfPresent(BizEmergencyReservePlanDO::getStartYear, reqVO.getStartYear())
                .eqIfPresent(BizEmergencyReservePlanDO::getEndYear, reqVO.getEndYear())
//                .eqIfPresent(BizEmergencyReservePlanDO::getJanuaryNumberOfDrills, reqVO.getJanuaryNumberOfDrills())
//                .eqIfPresent(BizEmergencyReservePlanDO::getFebruaryNumberOfDrills, reqVO.getFebruaryNumberOfDrills())
//                .eqIfPresent(BizEmergencyReservePlanDO::getMarchNumberOfDrills, reqVO.getMarchNumberOfDrills())
//                .eqIfPresent(BizEmergencyReservePlanDO::getAprilNumberOfDrills, reqVO.getAprilNumberOfDrills())
//                .eqIfPresent(BizEmergencyReservePlanDO::getMayNumberOfDrills, reqVO.getMayNumberOfDrills())
//                .eqIfPresent(BizEmergencyReservePlanDO::getJuneNumberOfDrills, reqVO.getJuneNumberOfDrills())
//                .eqIfPresent(BizEmergencyReservePlanDO::getJulyNumberOfDrills, reqVO.getJulyNumberOfDrills())
//                .eqIfPresent(BizEmergencyReservePlanDO::getAugustNumberOfDrills, reqVO.getAugustNumberOfDrills())
//                .eqIfPresent(BizEmergencyReservePlanDO::getSeptemberNumberOfDrills, reqVO.getSeptemberNumberOfDrills())
//                .eqIfPresent(BizEmergencyReservePlanDO::getOctoberNumberOfDrills, reqVO.getOctoberNumberOfDrills())
//                .eqIfPresent(BizEmergencyReservePlanDO::getNovemberNumberOfDrills, reqVO.getNovemberNumberOfDrills())
//                .eqIfPresent(BizEmergencyReservePlanDO::getDecemberNumberOfDrills, reqVO.getDecemberNumberOfDrills())
                .eqIfPresent(BizEmergencyReservePlanDO::getStatus, reqVO.getStatus())
                .eqIfPresent(BizEmergencyReservePlanDO::getNumberOfFinish, reqVO.getNumberOfFinish())
//                .eqIfPresent(BizEmergencyReservePlanDO::getAppendix, reqVO.getAppendix())
//                .betweenIfPresent(BizEmergencyReservePlanDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime())
//                .eqIfPresent(BizEmergencyReservePlanDO::getDeptId, reqVO.getDeptId())
                .orderByDesc(BizEmergencyReservePlanDO::getId));
    }

    List<Map<String, Object>> getEmergencyHistogram();
}
